<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Head -->
<head>
    <meta charset="{echo C('S_CHARSET')}" />
    <title>{echo C('sitename')}后台管理</title>

    <meta name="description" content="后台管理" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <me http-equiv="Content-Type" content="text/html; charset={echo C('S_CHARSET')}" />
    <link rel="shortcut icon" href="/favicon.png" type="image/x-icon">
    
    {template Public:Page:css}
	
  
    <link href="/assets/css/dataTables.bootstrap.css" rel="stylesheet" />

    {template Public:Page:js}

</head>
<!-- /Head -->
<!-- Body -->
<body>
    
    <!-- Loading Container -->
    <div class="loading-container">
        <div class="loading-progress">
            <div class="rotator">
                <div class="rotator">
                    <div class="rotator colored">
                        <div class="rotator">
                            <div class="rotator colored">
                                <div class="rotator colored"></div>
                                <div class="rotator"></div>
                            </div>
                            <div class="rotator colored"></div>
                        </div>
                        <div class="rotator"></div>
                    </div>
                    <div class="rotator"></div>
                </div>
                <div class="rotator"></div>
            </div>
            <div class="rotator"></div>
        </div>
    </div>
    <!--  /Loading Container -->
    <!-- Navbar -->
    <div class="navbar">
        <div class="navbar-inner">
            <div class="navbar-container">
                <!-- Navbar Barnd -->
                <div class="navbar-header pull-left">
                    <a href="#" class="navbar-brand">
                        <small>
                            <img src="{echo AURL}/img/logo.png" alt="" />
                        </small>
                    </a>
                </div>
                <!-- /Navbar Barnd -->

                <!-- Sidebar Collapse -->
                <div class="sidebar-collapse" id="sidebar-collapse">
                    <i class="collapse-icon fa fa-bars"></i>
                </div>
                <!-- /Sidebar Collapse -->
                <!-- Account Area and Settings --->
                <div class="navbar-header pull-right">
                    <div class="navbar-account">
                        <ul class="account-area">
                        
                            <li> 
                            	<a title="更新系统缓存" href="javascript:;" id="UpdateCache">
                                    <i class="icon fa fa-retweet"></i>
                                </a>
                             </li>    
                             
                             <li>
                             <a title="在线升级系统"  href="javascript:;" id="UpdatePatch">
                                    <i class="icon fa fa-wrench"></i>
                                    <span class="badge" id="UpdateProgress" style="display:none">0</span>
                                </a>
                             </li>     

                            <li>
                                <a class="wave in dropdown-toggle" href="/member/dialog">
                                    <i class="icon fa fa-envelope"></i>
                                    <span class="badge" id="AdminDialogRead">0</span>
                                </a>
                            </li>

                            <li>
                                <a class="dropdown-toggle" href="/member/notice">
                                    <i class="icon glyphicon glyphicon-bell"></i>
                                    <span class="badge" id="AdminNoticeRead">0</span>
                                </a>
                            </li>
                            
                            <li>
                                <a data-toggle="dropdown" class="login-area dropdown-toggle" style="width:160px;">
                                    <div title="View your public profile" class="avatar">
                                        {echo GetAvatarSimple($uid,48)}
                                    </div>
                                    <section>
                                        <h2><span class="profile"><span>{echo $username}</span></span></h2>
                                    </section>
                                </a>
                                <!--Login Area Dropdown-->
                                <ul class="pull-right dropdown-menu dropdown-arrow dropdown-login-area">
                                    <li class="username">{echo $username}</li>
                                    <li class="email">{echo $group['title']}</li>
                                    <li>
                                        <div class="avatar-area" style="width:120px;">
                                            {echo GetAvatarSimple($uid,120)}
                                            <a class="pull-left" href="/member/avatar"><span class="caption" style="font-size:12px;width:120px;">更改头像</span></a>
                                        </div>
                                    </li>
                                    <li class="edit">
                                         <a class="pull-left" href="/admin/auth/member">我的管理权限</a>
                                         <a class="pull-left" href="/logout" title="退出登录" style="padding-left:20px;">安全退出登录</a>
                                    </li>
                                    <div id="UserUid" style="display:none">0</div>
                                </ul>
                                <!--/Login Area Dropdown-->
                            </li>
                        </ul>
                        
                        <div class="setting">
                            <a href="/logout" title="退出登录">
                                <i class="icon glyphicon glyphicon-off"></i>
                            </a>
                        </div>
                    </div>
                </div>
                <!-- /Account Area and Settings -->
            </div>
        </div>
    </div>
    <!-- /Navbar -->
    
<script>
$(function(){
	    
        $("#UpdateCache").on('click', function () {

		       $.post('/admin/update/cache', function(json) {
			 
				 $('.bootbox').PhpappProgress({json:json});

				 return true;
				
			  }, 'json');
			  
          	 bootbox.dialog({
				 message: '<div class="progress progress-striped active"><div style="width: 1%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="20" role="progressbar" class="progress-bar progress-bar-info"><span>0%</span></div></div>',
				 title: '<i class="icon fa fa-retweet"></i> 更新缓存中',
				 closeButton: false
           	 }).PhpappProgress();
			 

		      return false;
		  
        });
		
		$("#UpdatePatch,#OpenUpdate").on('click', function () {

		       $.post('{echo C('FOXPHP_DOMAIN')}/update/{echo C("version")}',{foxphpid:{echo C('FOXPHP_ID')},uid:UID,clientkey:'{echo C("FOXPHP_AUTHORIZEKEY")}'}, function(json) {
			 	
					if(json.status=='ok'){
						bootbox.hideAll();
						
						var message='<table class="table table-hover"><thead><tr><th>最新版本</th><th>您当前版本</th><th>更新名称</th><th>安全等级</th><th>总大小</th></tr></thead><tbody><tr><td>'+json.data.patchdate+'</td><td>'+json.data.version+'</td><td>'+json.data.subject+'</td><td>'+json.data.security+'</td><td>'+json.data.filesize+'k</td></tr></tbody></table><b>更新说明</b><p>'+json.data.description+'</p>';
									
						 bootbox.confirm({  
							buttons: {  
							  confirm: {  
								 label: '立即更新',  
							  },  
							  cancel: {  
								 label: '取消',  
							  }  
							},  
							title:json.title,
							message: message,  
							callback: function(result) {  
								if(result) {  
								
									bootbox.hideAll();
								
									bootbox.dialog({
										 message: '<div class="progress progress-striped active"><div style="width: 1%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="20" role="progressbar" class="progress-bar progress-bar-info"><span>0%</span></div></div>',
										 title: '<i class="icon fa fa-retweet"></i> 更新中...',
										 closeButton: false
									 }).addClass("FOXPHP_UPDATE");
			 
								 	$.post('{echo C('FOXPHP_DOMAIN')}/update/patch/'+json.data.patchdate,{foxphpid:{echo C('FOXPHP_ID')},uid:UID,clientkey:'{echo C("FOXPHP_AUTHORIZEKEY")}',updatekey:'{echo $updatekey}'}, function(json) {
										
										if(json.status=='error'){
											bootbox.hideAll();
											bootbox.alert({ 
												size: 'small',
												title: json.title,
												message: json.message
											 })
										}
										
										 return true;
										
									  }, 'json');
								 		
									 return false; 
								}
							} 
						
						})
					}else{
						$('.bootbox').PhpappProgress({json:json});
					}
				     

				 return true;
				
			  }, 'json');
			  
          	 bootbox.dialog({
				 message: '<div class="progress progress-striped active"><div style="width: 1%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="20" role="progressbar" class="progress-bar progress-bar-info"><span>0%</span></div></div>',
				 title: '<i class="icon fa fa-retweet"></i> 获取更新中...',
				 closeButton: false
           	 }).PhpappProgress();
			 

		      return false;
		  
        });
	   
});
</script> 
    
    <!-- Main Container -->
    <div class="main-container container-fluid">
        <!-- Page Container -->
        <div class="page-container">
            <!-- Page Sidebar -->
             {template Public:Admin:menu}
            <!-- /Page Sidebar -->
            <!-- Page Content -->
            <div class="page-content">
                
                {template Public:Admin:path}

                <!-- Page Body -->
                <div class="page-body">
                
                {template Public:Admin:action}